package com.cango.student;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
import java.net.UnknownHostException;
import java.time.LocalTime;
import java.util.Arrays;
import java.util.List;

public class Boxed {
    public static List<Integer> integers = Arrays.asList(1,2,3,4,5,6,7,8,9,10);
    public static void main(String[] args) {
//        integers.stream().reduce(Integer.MIN_VALUE, (a,b) -> Integer.max(a, b));
        String value="";
        try (Socket client = new Socket("172.16.17.25", 8080)) {
            LocalTime now = LocalTime.now();
            value =  " start " + now;
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new BufferedInputStream(client.getInputStream())));
            bufferedReader.lines().forEach(s -> System.out.println(s));
        } catch (UnknownHostException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            LocalTime now = LocalTime.now();
            value = value + "    " + " end " + now;

            System.out.println(value);
        }
    }
}
